<?php if (!defined('THINK_PATH')) exit();?><script src="/mydemo/Public/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/mydemo/Public/uploadify/uploadify.css">
      <p class="user_title" style="height: 40px;line-height: 40px;border-bottom: 1px solid #fff;">
        <span style="font-size: 20px; padding-left: 12px;"><?php echo ($data); ?></span>
      <form>
       <input type="file" name="file_upload" id="file_upload" />
         <div id="image" class="image col-sm-12"></div>
            <input type="hidden" id="url" value="/mydemo/index.php/User">
            <input type="hidden" id="root" value="/mydemo">
            <input type="hidden" id="public" value="/mydemo/Public">
     </form>
      </p>
          <?php if(is_array($img)): $i = 0; $__LIST__ = $img;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$g): $mod = ($i % 2 );++$i;?><div class="col-sm-4 col-md-3">
            <a href="#" class="thumbnail">
              <img src="/mydemo/Public/<?php echo ($g["thumb_url"]); ?>" imgtitle="周英秋傻B" class="imgcss" onerror="this.src='/mydemo/Public/img/moren.jpg'" alt="...">
                 <span id="<?php echo ($g["id"]); ?>" style="position:absolute;left:0;top:140px;width:100%;height:30%;background:rgba(0,0,0,.3);display:none;text-align:center;margin-top:0px;color:#fff;font-size:15px;">
                  <p class="content2"><?php echo ($g["title"]); ?></p>
                </span>
            </a>
          </div><?php endforeach; endif; else: echo "" ;endif; ?>       
 <script type="text/javascript">
        $(function(){
			     $('.thumbnail').mouseover(function() {
			     	$(this).children('span').show();
			     });
			     $('.thumbnail').mouseleave(function() {
			     	$(this).children('span').hide();
			     });
     });


/*   function del(delName,delId){      //点击删除链接，ajax
      var info=$('#url').val();  //获取url
      var d='#'+delName;
    var url=info+"/del";    //删除图片的路径
         $.post(url,{'name':delId},function(data){    //ajax后台
            $(d).html(data.info);           //输出后台返回信息
            $(d).hide(3000);              //自动隐藏
        },'json');                    //josn格式

    }*/

    $(function() {
      $('#file_upload').uploadify({
        'formData'     : {
          'timestamp' : '<?php echo ($time); ?>',            //时间
          'token'     : '<?php echo (md5($time )); ?>',    //加密字段
          'url'   : '/mydemo/Public'+'/upload/', //url
          'imageUrl'  : $('#root').val()        //root
        },

        'fileTypeDesc' : 'Image Files',         //类型描述
        //'removeCompleted' : false,    //是否自动消失
            'fileTypeExts' : '*.gif; *.jpg; *.png',   //允许类型
            'fileSizeLimit' : '3MB',          //允许上传最大值
        'swf'      :$('#public').val()+'/uploadify/uploadify.swf', //加载swf
        'uploader' : '/mydemo/index.php'+'/User/uploadify',          //上传路径
        'buttonText' :'上传图片',                 //按钮的文字

        'onUploadSuccess' : function(file, data, response) {      //成功上传返回
              var n=parseInt(Math.random()*100);                //100以内的随机数
              //alert(n+data);
              //插入到image标签内，显示图片的缩略图
        $('#image').append('<div id="'+n+'" class="col-sm-4 col-md-3"><a href="/mydemo/Public'+data+'" class="thumbnail" target="_blank"><img src="/mydemo/Public'+data+'"  /></a></div>');

        }

      });
    });
 </script>